import cv2
import numpy as np


# img = cv2.imread("fe7.png")
# cv2.imshow("ok", img)
# img_1 = np.array(img)
# img_1 = (img_1 * 0.6).astype("uint8")
# cv2.imshow("1", img_1)

# # k = cv2.waitKey(0)


from aip import AipOcr


def ocr_aip(img_path):
    APP_ID = '25827715'
    API_KEY = '8rb7DAjL6wYFUMwMyjKRcV2r'
    SECRET_KEY = 'MCIQsXlt0lgF4bHnonRKIehfdwsTb7V4'
    client = AipOcr(APP_ID, API_KEY, SECRET_KEY)

    def get_file_content(filePath):
        with open(filePath, "rb") as fp:
            return fp.read()
    img_p = get_file_content(img_path)

    # ocr 有basicGeneral basicAccurate general accurate等等
    return client.basicAccurate(img_p)['words_result']


res = ocr_aip("fe0.png")
i0 = ""
for i in res:
    i0 = i['words'] + i0
    # print(i0)
print(i0)
